package com.fly.springbootTemplate.controller;

import com.fly.springbootTemplate.entity.Role;
import com.fly.springbootTemplate.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/role")
public class RoleController {
    @Autowired
    private RoleService roleService;
    @RequestMapping("/addRole")
    public boolean addRole(Role role){
        return roleService.addRole(role);
    }
    @RequestMapping("/deleteRole")
    public boolean deleteRole(Integer role_id){
        return roleService.deleteRole(role_id);
    }
    @RequestMapping("/updateRole")
    public boolean updateRole(Role role){
        return roleService.updateRole(role);
    }
    @RequestMapping("/getAllRole")
    public List<Role> getAllRole(){
        return roleService.getAllRole();
    }
    @RequestMapping("/getRoleById")
    public Role getRoleById(Integer role_id){
        return roleService.getRoleById(role_id);
    }
}
